<?php

require_once "include.php";

if($method == "GET"){
	$query = "SELECT * FROM dish WHERE on_promotion=1";

	$result = mysql_query($query) or die(mysql_error());  

	$return_arr = array();

	while($row = mysql_fetch_array( $result )){
		$dish = array(
					"id" => $row["id"],
					"name" => $row["name"],
					"image" => $row["image"],
					"description" => $row["description"],
					"rating" => $row["rating"],
					"price" => $row["price"],
					"on_promotion" => $row["on_promotion"],
					"stall_id" => $row["stall_id"]
					);

		$return_arr[] = $dish;
	}

	echo json_encode($return_arr);
}
else if($method == "POST"){
	// TODO:
}
else if($method == "DELETE"){
	// TODO:
}

?>